/**
 * 商品列表模块
 */
define(function(require, exports, module) {
	"require:nomunge,exports:nomunge,module:nomunge";


	var winWidth=0;
	window.onload=winChange;
	window.onresize=winChange;
	function winChange(){
		if (window.innerWidth){
	       winWidth = window.innerWidth;
	    }else if ((document.body) && (document.body.clientWidth)){
	       winWidth = document.body.clientWidth;		
		}	
		if(winWidth>=800&&winWidth<980){
				$("body").removeClass();
			    $("body").addClass("container_800");
		}else if(winWidth>=980&&winWidth<1280){
				$("body").removeClass();
				$("body").addClass("container_980");						
		}else if(winWidth>=1280&&winWidth<1400){
				$("body").removeClass();
				$("body").addClass("container_1280");
		}else if(winWidth>=1400){
				$("body").removeClass();
		}
	}
	
	
	
	$(function(){
		//商家主页一级分类切换
		$(document).on("click",".ldh-header-classNav span",function(){
			$(this).addClass("on").siblings().removeClass("on")	
		});
		$(document).on("focus","a,input:button,input:submit,button,input:checkbox,input:radio",function(){this.blur()});
		$(document).on("focus","a,input:button,input:submit,button,input:checkbox,input:radio",function(){this.blur()});
		$(document).on("click","#ldh-cart .ldh-cart-nav",function(){
			if(!$(this).parent().hasClass("on")){
				$(this).parent().addClass("on");	
				$ldh_cart.getCartList();
			}else{$(this).parent().removeClass("on");}
			/*$(document).on("click",function(event){
				var _target=$(event.target).parents();
				if(!_target.hasClass("ldh-cart")){$("#ldh-cart").removeClass("on");}			
			});*/
		});
		
	});
	
	var merchandiseTypeId="",merchandiseName="",sort="0",pageSize=24;
	
	var validate = require("../../custom/base/component-validate.js");
	
	require("../../custom/base/component-core.js");
	
	var base = require("../../custom/base/component-base.js");
	
	base.init(base);
	
	var cart=require("../../custom/cart/module-cart.js");
	
	cart.init(cart);

	
	var async = require("../../custom/base/component-async.js");
	
	require("../../custom/base/component-md5.js");
	
	require("../../custom/base/component-page.js");
	
	var head=require("../../custom/head/module-head.js");
	
	head.init(head);
	
	//设置列表页码
	exports.setCurrentPage=function(currentPage){
		
		this.currentPage=currentPage;
		
	};
	
	//获取列表页码
	exports.getCurrentPage=function(){
		
		return this.currentPage==null?1:this.currentPage;
		
	};
	
	
	//初始化函数
	exports.init=function(m){
		
		window.$ldh_merchandise=m;
		
		base.setFromPage("merchandiseList");
		
	    var url=decodeURI(document.URL);
				
		if(url.indexOf("?")>0){
			
			var params=url.split("?")[1];
			
			params=base.decodeParams(params);
			
			merchandiseName=params.split("=")[1];
			
			$("#merchandiseName").val(merchandiseName);
			
		}
		
		getMerchandiseType();
		
		getMerchandiseList();
				
		var userId=$("#session_userid").val();
		
		if(!validate.isNull(userId)){
			
			base.hasLoginShow(userId,$("#session_username").val(),$("#session_iconurl").val());
		}
		
		
	};
	
	//查询商家商品分类
	function getMerchandiseType(){
		

			eval(
					Wind.compile("async", function() {

						var data = $await(async.DDF_AsyncRequest("POST", ctx+"/shopweb/GoodsType/queryAllMerchandiseTypelistByShopId.do", ""));
						
						
						if(data["code"]==1){
		
							var htmlStr="";
							
							var length=data["goodsTypeList"].length;
							
							for (var i = 0; i < length; i++) {


											if(length<=7){
												
												htmlStr += '<li>';
												htmlStr += '<div class="ldh-navClassall-dlbox">';
												htmlStr += '<dl>';
												htmlStr += '<dt onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["merchandiseTypeName"]+'")><span>'+data["goodsTypeList"][i]["merchandiseTypeName"]+'</span></dt>';
												if(data["goodsTypeList"][i]["childTypeList"].length>=1){
													htmlStr += '<dd onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i]["childTypeList"][0]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["childTypeList"][0]["merchandiseTypeName"].replace('\n','')+'","'+data["goodsTypeList"][i]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["merchandiseTypeName"]+'")><span>'+base.subString(data["goodsTypeList"][i]["childTypeList"][0]["merchandiseTypeName"],6)+'</span></dd>';
												}
												if(data["goodsTypeList"][i]["childTypeList"].length>=2){
													htmlStr += '<dd onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i]["childTypeList"][1]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["childTypeList"][1]["merchandiseTypeName"].replace('\n','')+'","'+data["goodsTypeList"][i]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["merchandiseTypeName"]+'")><span>'+base.subString(data["goodsTypeList"][i]["childTypeList"][1]["merchandiseTypeName"],6)+'</span></dd>';
												}
												if(data["goodsTypeList"][i]["childTypeList"].length>=3){
													htmlStr += '<dd onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i]["childTypeList"][2]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["childTypeList"][2]["merchandiseTypeName"].replace('\n','')+'","'+data["goodsTypeList"][i]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["merchandiseTypeName"]+'")><span>'+base.subString(data["goodsTypeList"][i]["childTypeList"][2]["merchandiseTypeName"],6)+'</span></dd>';
												}
												htmlStr += '</dl>';
												htmlStr += '</div>';
												htmlStr += '<div class="ldh-navClassall-list2">';
												htmlStr += '<div class="ldh-navClassall-c">';
												htmlStr += '<h3><span onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["merchandiseTypeName"]+'")>'+data["goodsTypeList"][i]["merchandiseTypeName"]+'</span></h3>';
												htmlStr += '<div>';
												for(var j=0;j<data["goodsTypeList"][i]["childTypeList"].length;j++){
													
													var merchandiseTypeName=data["goodsTypeList"][i]["childTypeList"][j]["merchandiseTypeName"].replace('\n','');
													
													
													htmlStr += '<p onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i]["childTypeList"][j]["merchandiseTypeId"]+'","'+merchandiseTypeName+'","'+data["goodsTypeList"][i]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["merchandiseTypeName"]+'")><span>'+data["goodsTypeList"][i]["childTypeList"][j]["merchandiseTypeName"]+'</span></p>';

												}
												htmlStr += '</div></div>';
											/*	htmlStr += '<div class="ldh-navClassall-c">';
												htmlStr += '<h3><span>个人护理</span></h3>';
												htmlStr += '<div><p><span>BB霜</span></p><p><span>SK-t</span></p><p><span>玉兰油</span></p></div>';
												htmlStr += '</div>';
												htmlStr += '</div>';*/
												htmlStr += '</li>';
											}else{
												
												htmlStr += '<li>';
												htmlStr += '<div class="ldh-navClassall-dlbox">';
												htmlStr += '<dl>';
												
												if(i+1<length){
													htmlStr += '<dt onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["merchandiseTypeName"]+'")><span>'+data["goodsTypeList"][i]["merchandiseTypeName"]+"/"+data["goodsTypeList"][i+1]["merchandiseTypeName"]+'</span></dt>';
												
													
													if(data["goodsTypeList"][i]["childTypeList"].length>=1){
														htmlStr += '<dd onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i]["childTypeList"][0]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["childTypeList"][0]["merchandiseTypeName"]+'","'+data["goodsTypeList"][i]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["merchandiseTypeName"]+'")><span>'+base.subString(data["goodsTypeList"][i]["childTypeList"][0]["merchandiseTypeName"],6)+'</span></dd>';
													}
													if(data["goodsTypeList"][i]["childTypeList"].length>=2){
														htmlStr += '<dd onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i]["childTypeList"][1]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["childTypeList"][1]["merchandiseTypeName"]+'","'+data["goodsTypeList"][i]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["merchandiseTypeName"]+'")><span>'+base.subString(data["goodsTypeList"][i]["childTypeList"][1]["merchandiseTypeName"],6)+'</span></dd>';
													}
													if(data["goodsTypeList"][i]["childTypeList"].length>=3){
														htmlStr += '<dd onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i]["childTypeList"][2]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["childTypeList"][2]["merchandiseTypeName"]+'","'+data["goodsTypeList"][i]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["merchandiseTypeName"]+'")><span>'+base.subString(data["goodsTypeList"][i]["childTypeList"][2]["merchandiseTypeName"],6)+'</span></dd>';
													}
													if(data["goodsTypeList"][i+1]["childTypeList"].length>=1){
														htmlStr += '<dd onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i+1]["childTypeList"][0]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i+1]["childTypeList"][0]["merchandiseTypeName"]+'","'+data["goodsTypeList"][i+1]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i+1]["merchandiseTypeName"]+'")><span>'+base.subString(data["goodsTypeList"][i+1]["childTypeList"][0]["merchandiseTypeName"],6)+'</span></dd>';
													}
													if(data["goodsTypeList"][i+1]["childTypeList"].length>=2){
														htmlStr += '<dd onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i+1]["childTypeList"][1]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i+1]["childTypeList"][1]["merchandiseTypeName"]+'","'+data["goodsTypeList"][i+1]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i+1]["merchandiseTypeName"]+'")><span>'+base.subString(data["goodsTypeList"][i+1]["childTypeList"][1]["merchandiseTypeName"],6)+'</span></dd>';
													}
													if(data["goodsTypeList"][i+1]["childTypeList"].length>=3){
														htmlStr += '<dd onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i+1]["childTypeList"][2]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i+1]["childTypeList"][2]["merchandiseTypeName"]+'","'+data["goodsTypeList"][i+1]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i+1]["merchandiseTypeName"]+'")><span>'+base.subString(data["goodsTypeList"][i+1]["childTypeList"][2]["merchandiseTypeName"],6)+'</span></dd>';
													}
													
													
												}else{
													
													htmlStr += '<dt onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["merchandiseTypeName"]+'")><span>'+data["goodsTypeList"][i]["merchandiseTypeName"]+'</span></dt>';

													if(data["goodsTypeList"][i]["childTypeList"].length>=1){
														htmlStr += '<dd onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i]["childTypeList"][0]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["childTypeList"][0]["merchandiseTypeName"]+'","'+data["goodsTypeList"][i]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["merchandiseTypeName"]+'")><span>'+base.subString(data["goodsTypeList"][i]["childTypeList"][0]["merchandiseTypeName"],6)+'</span></dd>';
													}
													if(data["goodsTypeList"][i]["childTypeList"].length>=2){
														htmlStr += '<dd onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i]["childTypeList"][1]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["childTypeList"][1]["merchandiseTypeName"]+'","'+data["goodsTypeList"][i]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["merchandiseTypeName"]+'")><span>'+base.subString(data["goodsTypeList"][i]["childTypeList"][1]["merchandiseTypeName"],6)+'</span></dd>';
													}
													if(data["goodsTypeList"][i]["childTypeList"].length>=3){
														htmlStr += '<dd onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i]["childTypeList"][2]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["childTypeList"][2]["merchandiseTypeName"]+'","'+data["goodsTypeList"][i]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["merchandiseTypeName"]+'")><span>'+base.subString(data["goodsTypeList"][i]["childTypeList"][2]["merchandiseTypeName"],6)+'</span></dd>';
													}
												}
												
												
												
												htmlStr += '</dl>';
												htmlStr += '</div>';
												htmlStr += '<div class="ldh-navClassall-list2">';
												
												if(i+1<length){
													
													htmlStr += '<div class="ldh-navClassall-c">';
													htmlStr += '<h3><span onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["merchandiseTypeName"]+'")>'+data["goodsTypeList"][i]["merchandiseTypeName"]+'</span></h3>';
													htmlStr += '<div>';
													for(var j=0;j<data["goodsTypeList"][i]["childTypeList"].length;j++){
														
														htmlStr += '<p onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i]["childTypeList"][j]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["childTypeList"][j]["merchandiseTypeName"]+'","'+data["goodsTypeList"][i]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["merchandiseTypeName"]+'")><span>'+data["goodsTypeList"][i]["childTypeList"][j]["merchandiseTypeName"]+'</span></p>';

													}
													htmlStr += '</div></div>';
												    
													htmlStr += '<div class="ldh-navClassall-c">';
													htmlStr += '<h3><span onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i+1]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i+1]["merchandiseTypeName"]+'")>'+data["goodsTypeList"][i+1]["merchandiseTypeName"]+'</span></h3>';
													htmlStr += '<div>';
													for(var j=0;j<data["goodsTypeList"][i+1]["childTypeList"].length;j++){
														
														htmlStr += '<p onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i+1]["childTypeList"][j]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i+1]["childTypeList"][j]["merchandiseTypeName"]+'","'+data["goodsTypeList"][i+1]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i+1]["merchandiseTypeName"]+'")><span>'+data["goodsTypeList"][i+1]["childTypeList"][j]["merchandiseTypeName"]+'</span></p>';

													}
													htmlStr += '</div></div>';
													
													i=i+1;
													
												}else{
													
													htmlStr += '<div class="ldh-navClassall-c">';
													htmlStr += '<h3><span onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["merchandiseTypeName"]+'")>'+data["goodsTypeList"][i]["merchandiseTypeName"]+'</span></h3>';
													htmlStr += '<div>';
													for(var j=0;j<data["goodsTypeList"][i]["childTypeList"].length;j++){
														
														htmlStr += '<p onclick=$ldh_merchandise.setMerchandiseType("'+data["goodsTypeList"][i]["childTypeList"][j]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["childTypeList"][j]["merchandiseTypeName"]+'","'+data["goodsTypeList"][i]["merchandiseTypeId"]+'","'+data["goodsTypeList"][i]["merchandiseTypeName"]+'")><span>'+data["goodsTypeList"][i]["childTypeList"][j]["merchandiseTypeName"]+'</span></p>';

													}
													htmlStr += '</div></div>';
												/*	htmlStr += '<div class="ldh-navClassall-c">';
													htmlStr += '<h3><span>个人护理</span></h3>';
													htmlStr += '<div><p><span>BB霜</span></p><p><span>SK-t</span></p><p><span>玉兰油</span></p></div>';
													htmlStr += '</div>';
													htmlStr += '</div>';*/
												}
											
												htmlStr += '</li>';
												
												
											}
											

							}
							
							$("#shopMerchandiseTypeList").html(htmlStr);

						}
						
						
					}))().start();
			
	}
	
	//设置商品分类
	var merchandiseTypeName;
	exports.setMerchandiseType=function(id,typeName,parentId,parentTypeName){
		
		$('html, body').animate({scrollTop:0}, 'slow');
		
		merchandiseTypeId=id;
		
		exports.setCurrentPage(1);
				
		merchandiseName="";
		
		$("#merchandiseName").val("");
		
		
		$("#merchandiseList").html("");
				
		getMerchandiseList();
		
		
		if(!validate.isNull(typeName)){
			
			$("#div_currentType").show();
			
			if(validate.isNull(parentTypeName)){
				
				$("#currentTypeName").html('分类：<a href=javascript:$ldh_merchandise.setMerchandiseType("","")>全部</a> ＞ '+typeName);
				
			}else{
				
				$("#currentTypeName").html('分类：<a href=javascript:$ldh_merchandise.setMerchandiseType("","")>全部</a> ＞  <a href=javascript:$ldh_merchandise.setMerchandiseType("'+parentId+'","'+parentTypeName+'")>'+parentTypeName+'</a> ＞ '+typeName);
			}
			
			
		}else{
			
			$("#div_currentType").hide();
		}
		merchandiseTypeName=typeName;
	
	};
	
	// 搜索商家商品
	exports.searchMerchandise=function(){
		
		merchandiseName=$("#merchandiseName").val();
		
		if(merchandiseName=="搜索商品" || validate.isNull(merchandiseName)){
			
			return;
		}
		
		merchandiseTypeName="";
		
		merchandiseTypeId="";
		
		$("#div_currentType").hide();
		
		exports.setCurrentPage(1);
		
		$("#merchandiseList").html("");
		
		getMerchandiseList();
		
	};
	
	
	// 获取商家商品
	function getMerchandiseList(){
		
		/*if(validate.isNull(merchandiseName))
			return;*/
		
		var params = {
				lng:base.getCookie("lng"),
				lat:base.getCookie("lat"),
				//shopId:"201410232110440093",
				goodName:merchandiseName,
				goodType:merchandiseTypeId,
				sort: sort,
				pageSize : pageSize,
				currentPage : exports.getCurrentPage()
		};
		

		$('#footPage').html("");
		
			
		base.showLoading("#merchandiseList");
		
			eval(
					Wind.compile("async", function() {

						var data = $await(async.DDF_AsyncRequest("POST", ctx+"/shopweb/Goods/goodsList.do", params));
						
						
						if(data["code"]==1){
							
							var htmlStr="";

																	
							for (var i = 0; i < data["goodsList"].length; i++) {
								
											var obj=data["goodsList"][i];
											var isDiaPlay="display:none;";
											if(!validate.isNull(obj["isCartNum"]) && parseInt(obj["isCartNum"])>0){
												isDiaPlay="display:inline;";
											}
											//alert("isCartNum=="+obj["isCartNum"]);
											var _merchandiseName=obj["merchandiseName"];
											if(_merchandiseName.toString().length>12){
												_merchandiseName=_merchandiseName.toString().substring(0,11)+"...";
											}
											htmlStr += '<div class="ldh-goods-box">';
											htmlStr += '<div class="ldh-gb-top" style="cursor:default;">';
											
											if(validate.isNull(obj["picDefault"])){
												
												///htmlStr += '<img class="lazy"  id="'+obj["merchandiseId"]+'"  data-original="'+ctx+'/v1/img/default_234_220.png" />';
												htmlStr += '<img class="lazy"  id="'+obj["merchandiseId"]+'"  src="'+ctx+'/v1/img/default_234_220.png" />';

											}else{
												
											//	htmlStr += '<img class="lazy"  id="'+obj["merchandiseId"]+'" onload=$ldh_base.ResizeImage("'+obj["merchandiseId"]+'") data-original="'+fileOpenSourceUrl+obj["picDefault"]+'" />';
												
												htmlStr += '<img class="lazy"  id="'+obj["merchandiseId"]+'" onload=$ldh_base.ResizeImage("'+obj["merchandiseId"]+'") src="'+fileOpenSourceUrl+obj["picDefault"]+'" />';

											}
											
											htmlStr += '</div>';
											
											if(obj["recommended"]=="1"){
												
												htmlStr += '<i class="ldh-recommend"></i>';
											}
											htmlStr += '<div class="ldh-gb-main">';
											htmlStr += '<h3 title='+obj["merchandiseName"]+'>'+_merchandiseName+'</h3>';
											/*if(obj["brief"]!=""){
												htmlStr += '<p>'+obj["brief"]+'</p>';
											}else{
												htmlStr += '<p>'+obj["merchandiseName"]+'</p>';
											}*/
											htmlStr += '<p>店铺:<a href=javascript:$ldh_base.jumpToShopIndex("'+obj["shopId"]+'")>'+obj["shopName"]+'</a></p>';
											htmlStr += '</div>';
											htmlStr += '<div class="ldh-gb-bottom clearfix">';
											htmlStr += '<div class="fl-left">';
											var unitName=obj["unitName"];
											if(!validate.isNull(obj["unitName"])){
												
												unitName="/"+unitName;
											}
											htmlStr += '<p class="ldh-goods-sj" style="font-size:20px">¥'+obj["price"].toFixed(2)+unitName+'</p>';
											if(obj["mktprice"]>obj["price"]){
												htmlStr += '<p class="ldh-goods-scj" style="font-size:16px">¥'+obj["mktprice"].toFixed(2)+unitName+'</p>';
											}
											htmlStr += '</div>';
											htmlStr += '<div class="fl-right">';
											htmlStr += '<input type="hidden" id="cartId'+exports.getCurrentPage()+i+'" value="'+obj["cartId"]+'"/>';
											htmlStr += '<button type="button" class="ldh-goods-sub" id="sub_'+obj["merchandiseId"]+'" onclick=$ldh_cart.deleteCartNum(this,"'+obj["merchandiseId"]+'","'+obj["price"]+'",'+exports.getCurrentPage()+i+') style="'+isDiaPlay+'"></button>';
											htmlStr += '<button type="button" class="ldh-goods-add" onclick=$ldh_cart.addCartNum(this,"'+obj["shopId"]+'","'+obj["merchandiseId"]+'","'+obj["price"]+'",'+exports.getCurrentPage()+i+')></button>';
											htmlStr += '</div>';
											htmlStr += '</div>';
											htmlStr += '<div class="ldh-gb-num" id="hasBuy_'+obj["merchandiseId"]+'" style="'+isDiaPlay+'"><span>'+obj["isCartNum"]+'</span><span></span></div>';
											htmlStr += '</div> ';
						   }
							
							if(htmlStr=="")
							{
							/*	if(validate.isNull(merchandiseName)){
									htmlStr+='<div class="ldh-cart-null"><p>暂时没有可出售的商品!</p></div>	';

								}else{
									
									if(validate.isNull(merchandiseTypeName)){
										
										htmlStr+='<div class="ldh-cart-null"><p>亲,抱歉哦！没有找到与“<font color="#ed5d3a!important">'+merchandiseName+'</font>”相关的商品呢!</p></div>	';

									}else{
										
										htmlStr+='<div class="ldh-cart-null"><p>亲,抱歉哦！没有在“<font color="#ed5d3a!important">'+merchandiseTypeName+'</font>”中找到与“<font color="#ed5d3a!important">'+merchandiseName+'</font>”相关的商品呢!</p></div>	';
	
									}
	
									htmlStr+='<div class="ldh-cart-null"><p>亲,抱歉哦！没有找到与“<font color="#ed5d3a!important">'+merchandiseName+'</font>”相关的商品呢!</p></div>	';

								}
								
								//$("#merchandiseList").css("height","400px");
								
								$("#merchandiseList").append(htmlStr);*/
								
								if(validate.isNull(merchandiseName) && validate.isNull(merchandiseTypeName)){
									htmlStr+='<div class="ldh-cart-null"><p>找不到商品!</p></div>	';

								}else if(!validate.isNull(merchandiseName)){
									htmlStr+='<div class="ldh-cart-null"><p>亲,抱歉哦！没有找到与“<font color="#ed5d3a!important">'+merchandiseName+'</font>”相关的商品呢!</p></div>	';

								}else if(!validate.isNull(merchandiseTypeName)){
									htmlStr+='<div class="ldh-cart-null"><p>亲,抱歉哦！没有找到分类为“<font color="#ed5d3a!important">'+merchandiseTypeName+'</font>”的相关商品呢!</p></div>	';
								}
								
								$("#merchandiseList").append(htmlStr);
								
								
							}else{
								
								//$("#merchandiseList").removeAttr("style");
								
								$("#merchandiseList").append(htmlStr);
								
								
								$('#footPage').ldh_pagination_shoplist(pageSize,parseInt(exports.getCurrentPage()),data["totals"],data["pages"],{  
									 
									 changePageCallback:function(pageSize,page){  
										
										 $('html, body').animate({scrollTop:0}, 0);
										 
										 exports.setCurrentPage(page);
										 
										 $("#merchandiseList").html("");
										 
										 getMerchandiseList();
										 
									 },
									 changePageSizeCallBack:function(pageSize){
									 } 
						         }); 
								
							}
							
							
						

						}
						
						base.cancelLoading("#merchandiseList");
												
						
					}))().start();
	
		
	}
	
});

